package com.jucai.pppeiyouclient.utils;

import android.view.Gravity;
import android.widget.Toast;

import com.jucai.pppeiyouclient.base.BaseApplication;

/**
 * Created by Kuky on 2017-02-15.
 */
public class ToastUtils {
    private static Toast mToast;

    /**
     * 普通吐司
     *
     * @param msg
     */
    public static void showToast(String msg) {
        if (mToast == null) {
            mToast = Toast.makeText(BaseApplication.getContext(), msg, Toast.LENGTH_SHORT);
        } else {
            mToast.setText(msg);
        }
        mToast.show();
    }

    /**
     * 界面中间
     *
     * @param msg
     */
    public static void showToastCenter(String msg) {
        if (mToast == null) {
            mToast = Toast.makeText(BaseApplication.getContext(), msg, Toast.LENGTH_SHORT);
        } else {
            mToast.setText(msg);
        }

        mToast.setGravity(Gravity.CENTER, 0, 0);
        mToast.show();
    }
}
